/**
 * jQuery-based messagebox toaster widget 
	// css:
	#toaster{z-index:9999;top:5px;left:25%;right:25%;position:absolute;position:fixed;}
	#toaster .toast{color:#FFF;font:bold 10pt Tahoma,Helvetica,sans-serif;overflow:hidden;margin:0 auto 5px;position:relative;border-style:solid;border-width:1px;border-color:#7ED675 #72D36A #67C75E;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-background-clip:padding;-webkit-background-clip:padding;background-clip:padding-box;-moz-box-shadow:0 0 0 1px rgba(0, 0, 0, 0.2),0 2px 7px 3px rgba(0, 0, 0, 0.3);-webkit-box-shadow:0 0 0 1px rgba(0, 0, 0, 0.2),0 2px 7px 3px rgba(0, 0, 0, 0.3);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.2),0 2px 7px 3px rgba(0, 0, 0, 0.3);}
	#toaster .toast .toast-closer{position:absolute;right:8px;top:8px;height:16px;width:16px;cursor:default;background:url("../new_img/icons/toaster-closer.png") 0 0 no-repeat;}
	#toaster .toast .toast-content{padding:7px 30px 10px;display:block;background:url("../new_img/icons/toaster-alert.png") 7px 9px no-repeat;word-wrap:break-word;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.9);line-height:1.4;}
	#toaster .toast-error{background:#B82906;border-color:#E8706C #E4524C #D53007;background:#d53007;background:-webkit-linear-gradient(top, #d53007, #a32505);background:-moz-linear-gradient(top, #d53007, #a32505);background:linear-gradient(top, #d53007, #a32505);}
	#toaster .toast-warning,
	#toaster .toast-alert{background:#CC6A29;border-color:#D7924F #D05B0D #DE7A38;background:#e07731;background:-webkit-linear-gradient(top, #e07731, #a54302);background:-moz-linear-gradient(top, #e07731, #a54302);background:linear-gradient(top, #e07731, #a54302);}
	#toaster .toast-info,
	#toaster .toast-success{background:#3B9133;border-color:#7ED675 #72D36A #67C75E;background:#59af51;background:-webkit-linear-gradient(top, #59af51, #318d29);background:-moz-linear-gradient(top, #59af51, #318d29);background:linear-gradient(top, #59af51, #318d29);}
 */


/**
 * Show a toast, e.g. Toaster('message to display');
 * 
 * @param {String} conf		info text for toast
 * OR
 * @param {Object} conf		toast config object:
 * 		type {String}			toast type ['info'|'error'], default 'info'
 * 		text {String}			toast text, default ''
 * 		delay {Number}			toast timeout, default 5
 * 		autoClose {Boolean}		auto close toast [true|false], default true
 */

var Toaster = function(conf, type){
	if (conf === undefined) return;
	if (typeof conf === 'string') conf = { text: conf, type: type || 'success' };
	conf = $.extend({}, { type:'info', delay:5, autoClose: true }, conf);
	var toaster = $('#toaster'), msgTimeout=null, toast=null,
		close = function(){ 
			if (msgTimeout)msgTimeout=clearTimeout(msgTimeout); 
			$(this).closest('.toast').fadeOut(function(){$(this).remove();});
		};
	if(!toaster.length) toaster = $('<div id="toaster"></div>').appendTo('body').on('click', '.toast-closer', close);
	toast=$('<div style="display:none" class="toast toast-'+conf.type+'"><span class="toast-closer" title="Dismiss"></span><span class="toast-content">'+conf.text+'</span></div>').appendTo(toaster).fadeIn('slow');
	if (conf.autoClose) msgTimeout = setTimeout(function(){close.call(toast);}, conf.delay*1000);
};
Toaster.toString = function(){return 'XWERX Toaster Messages Component';};